-- DROP USER MAIN_USER;

CREATE USER MAIN_USER
-- IDENTIFIED BY <password>
;

CREATE TABLE "MAIN_USER"."AUTHOR" 
   (	"AUTHOR_ID" NUMBER GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOKEEP  NOSCALE  NOT NULL ENABLE, 
	"AUTHOR_NAME" VARCHAR2(20) NOT NULL ENABLE, 
	"PASSWORD" VARCHAR2(20) NOT NULL ENABLE, 
	"EARNING" NUMBER(18,2) DEFAULT 0, 
	"PHONE" VARCHAR2(11), 
	"AVATAR_URL" VARCHAR2(255), 
	"REGISTER_TIME" DATE, 
	"INTRODUCTION" VARCHAR2(400), 
	 PRIMARY KEY ("AUTHOR_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

CREATE INDEX "MAIN_USER"."AUTHOR_NAME_INDEX" ON "MAIN_USER"."AUTHOR" ("AUTHOR_NAME") 
   INDEXTYPE IS "CTXSYS"."CONTEXT"  PARAMETERS ('LEXER author_lexer');
  CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007646" ON "MAIN_USER"."AUTHOR" ("AUTHOR_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."AUTHOR_INCOME" 
   (	"ID" NUMBER(19,0) GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOKEEP  NOSCALE  NOT NULL ENABLE, 
	"AUTHOR_ID" NUMBER(19,0) NOT NULL ENABLE, 
	"TYPE" VARCHAR2(20) NOT NULL ENABLE, 
	"AMOUNT" NUMBER(10,2) NOT NULL ENABLE, 
	"CREATE_TIME" TIMESTAMP (6) DEFAULT SYSTIMESTAMP NOT NULL ENABLE, 
	"NOVEL_ID" NUMBER(38,0), 
	 PRIMARY KEY ("ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."AUTHOR_INCOME" ADD CONSTRAINT "FK_AUTHOR_INCOME_AUTHOR" FOREIGN KEY ("AUTHOR_ID")
	  REFERENCES "MAIN_USER"."AUTHOR" ("AUTHOR_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007750" ON "MAIN_USER"."AUTHOR_INCOME" ("ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."CATEGORY" 
   (	"CATEGORY_NAME" VARCHAR2(20), 
	 PRIMARY KEY ("CATEGORY_NAME")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007647" ON "MAIN_USER"."CATEGORY" ("CATEGORY_NAME") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."CHAPTER" 
   (	"NOVEL_ID" NUMBER, 
	"CHAPTER_ID" NUMBER, 
	"TITLE" VARCHAR2(40), 
	"CONTENT" CLOB, 
	"WORD_COUNT" NUMBER NOT NULL ENABLE, 
	"PRICE_PER_KILO" NUMBER(10,2) DEFAULT 0.50, 
	"CALCULATED_PRICE" NUMBER GENERATED ALWAYS AS (ROUND("WORD_COUNT"/1000*"PRICE_PER_KILO",0)) VIRTUAL , 
	"IS_CHARGED" VARCHAR2(2), 
	"PUBLISH_TIME" DATE, 
	"STATUS" VARCHAR2(10) DEFAULT '草稿', 
	 CHECK (is_charged IN ('是', '否')) ENABLE, 
	 PRIMARY KEY ("NOVEL_ID", "CHAPTER_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE, 
	 CONSTRAINT "CHAPTER_STATUS_CK" CHECK ("STATUS" IN ('草稿', '审核中', '首次审核', '已发布', '封禁')) ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
 LOB ("CONTENT") STORE AS SECUREFILE (
  TABLESPACE "TS_EXAMPLE" ENABLE STORAGE IN ROW CHUNK 8192
  NOCACHE LOGGING  NOCOMPRESS  KEEP_DUPLICATES 
  STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) ;

ALTER TABLE "MAIN_USER"."CHAPTER" ADD FOREIGN KEY ("NOVEL_ID")
	  REFERENCES "MAIN_USER"."NOVEL" ("NOVEL_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007655" ON "MAIN_USER"."CHAPTER" ("NOVEL_ID", "CHAPTER_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
  CREATE UNIQUE INDEX "MAIN_USER"."SYS_IL0000074156C00004$$" ON "MAIN_USER"."CHAPTER" (
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
  PARALLEL (DEGREE 0 INSTANCES 0) ;
;

CREATE TABLE "MAIN_USER"."CHAPTER_MANAGEMENT" 
   (	"MANAGEMENT_ID" NUMBER, 
	"NOVEL_ID" NUMBER, 
	"CHAPTER_ID" NUMBER, 
	 PRIMARY KEY ("MANAGEMENT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."CHAPTER_MANAGEMENT" ADD FOREIGN KEY ("MANAGEMENT_ID")
	  REFERENCES "MAIN_USER"."MANAGEMENT" ("MANAGEMENT_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."CHAPTER_MANAGEMENT" ADD FOREIGN KEY ("NOVEL_ID", "CHAPTER_ID")
	  REFERENCES "MAIN_USER"."CHAPTER" ("NOVEL_ID", "CHAPTER_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007680" ON "MAIN_USER"."CHAPTER_MANAGEMENT" ("MANAGEMENT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."COLLECT" 
   (	"NOVEL_ID" NUMBER, 
	"READER_ID" NUMBER, 
	"IS_PUBLIC" VARCHAR2(10), 
	 PRIMARY KEY ("NOVEL_ID", "READER_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."COLLECT" ADD FOREIGN KEY ("NOVEL_ID")
	  REFERENCES "MAIN_USER"."NOVEL" ("NOVEL_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."COLLECT" ADD FOREIGN KEY ("READER_ID")
	  REFERENCES "MAIN_USER"."READER" ("READER_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007686" ON "MAIN_USER"."COLLECT" ("NOVEL_ID", "READER_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."COMMENTS" 
   (	"COMMENT_ID" NUMBER GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOKEEP  NOSCALE  NOT NULL ENABLE, 
	"READER_ID" NUMBER NOT NULL ENABLE, 
	"NOVEL_ID" NUMBER NOT NULL ENABLE, 
	"CHAPTER_ID" NUMBER NOT NULL ENABLE, 
	"TITLE" VARCHAR2(40) NOT NULL ENABLE, 
	"CONTENT" CLOB, 
	"LIKES" NUMBER(*,0) DEFAULT 0, 
	"STATUS" VARCHAR2(10) DEFAULT '通过', 
	"CREATE_TIME" DATE, 
	 CHECK (status IN ('封禁', '通过')) ENABLE, 
	 PRIMARY KEY ("COMMENT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
 LOB ("CONTENT") STORE AS SECUREFILE (
  TABLESPACE "TS_EXAMPLE" ENABLE STORAGE IN ROW CHUNK 8192
  NOCACHE LOGGING  NOCOMPRESS  KEEP_DUPLICATES 
  STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) ;

ALTER TABLE "MAIN_USER"."COMMENTS" ADD FOREIGN KEY ("READER_ID")
	  REFERENCES "MAIN_USER"."READER" ("READER_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."COMMENTS" ADD FOREIGN KEY ("NOVEL_ID")
	  REFERENCES "MAIN_USER"."NOVEL" ("NOVEL_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."COMMENTS" ADD FOREIGN KEY ("NOVEL_ID", "CHAPTER_ID")
	  REFERENCES "MAIN_USER"."CHAPTER" ("NOVEL_ID", "CHAPTER_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007709" ON "MAIN_USER"."COMMENTS" ("COMMENT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
  CREATE UNIQUE INDEX "MAIN_USER"."SYS_IL0000074194C00006$$" ON "MAIN_USER"."COMMENTS" (
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
  PARALLEL (DEGREE 0 INSTANCES 0) ;
;

CREATE TABLE "MAIN_USER"."COMMENT_MANAGEMENT" 
   (	"MANAGEMENT_ID" NUMBER, 
	"COMMENT_ID" NUMBER, 
	 PRIMARY KEY ("MANAGEMENT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."COMMENT_MANAGEMENT" ADD FOREIGN KEY ("MANAGEMENT_ID")
	  REFERENCES "MAIN_USER"."MANAGEMENT" ("MANAGEMENT_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."COMMENT_MANAGEMENT" ADD FOREIGN KEY ("COMMENT_ID")
	  REFERENCES "MAIN_USER"."COMMENTS" ("COMMENT_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007713" ON "MAIN_USER"."COMMENT_MANAGEMENT" ("MANAGEMENT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."COMMENT_REPLY" 
   (	"COMMENT_ID" NUMBER, 
	"PRE_COM_ID" NUMBER, 
	"COMMENT_LEVEL" NUMBER(*,0), 
	 CHECK (comment_level BETWEEN 1 AND 3) ENABLE, 
	 PRIMARY KEY ("COMMENT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."COMMENT_REPLY" ADD FOREIGN KEY ("COMMENT_ID")
	  REFERENCES "MAIN_USER"."COMMENTS" ("COMMENT_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."COMMENT_REPLY" ADD FOREIGN KEY ("PRE_COM_ID")
	  REFERENCES "MAIN_USER"."COMMENTS" ("COMMENT_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007725" ON "MAIN_USER"."COMMENT_REPLY" ("COMMENT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."DR$AUTHOR_NAME_INDEX$I" 
   (	"TOKEN_TEXT" VARCHAR2(255) NOT NULL ENABLE, 
	"TOKEN_TYPE" NUMBER(10,0) NOT NULL ENABLE, 
	"TOKEN_FIRST" NUMBER(10,0) NOT NULL ENABLE, 
	"TOKEN_LAST" NUMBER(10,0) NOT NULL ENABLE, 
	"TOKEN_COUNT" NUMBER(10,0) NOT NULL ENABLE, 
	"TOKEN_INFO" BLOB
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
 LOB ("TOKEN_INFO") STORE AS SECUREFILE (
  TABLESPACE "TS_EXAMPLE" ENABLE STORAGE IN ROW CHUNK 8192
  NOCACHE LOGGING  NOCOMPRESS  KEEP_DUPLICATES 
  STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) 
  MONITORING ;

CREATE INDEX "MAIN_USER"."DR$AUTHOR_NAME_INDEX$X" ON "MAIN_USER"."DR$AUTHOR_NAME_INDEX$I" ("TOKEN_TEXT", "TOKEN_TYPE", "TOKEN_FIRST", "TOKEN_LAST", "TOKEN_COUNT") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS COMPRESS 2 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
  CREATE UNIQUE INDEX "MAIN_USER"."SYS_IL0000075258C00006$$" ON "MAIN_USER"."DR$AUTHOR_NAME_INDEX$I" (
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
  PARALLEL (DEGREE 0 INSTANCES 0) ;
;

CREATE TABLE "MAIN_USER"."DR$AUTHOR_NAME_INDEX$K" 
   (	"DOCID" NUMBER, 
	"TEXTKEY" ROWID
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
  MONITORING ;

CREATE UNIQUE INDEX "MAIN_USER"."DR$AUTHOR_NAME_INDEX$KD" ON "MAIN_USER"."DR$AUTHOR_NAME_INDEX$K" ("DOCID", "TEXTKEY") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
  CREATE UNIQUE INDEX "MAIN_USER"."DR$AUTHOR_NAME_INDEX$KR" ON "MAIN_USER"."DR$AUTHOR_NAME_INDEX$K" ("TEXTKEY", "DOCID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."DR$AUTHOR_NAME_INDEX$N" 
   (	"NLT_DOCID" NUMBER(38,0), 
	"NLT_MARK" CHAR(1) NOT NULL ENABLE, 
	 PRIMARY KEY ("NLT_DOCID") ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  ORGANIZATION INDEX NOCOMPRESS PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
 PCTTHRESHOLD 50
  MONITORING ;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_IOT_TOP_75262" ON "MAIN_USER"."DR$AUTHOR_NAME_INDEX$N" ("NLT_DOCID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."DR$AUTHOR_NAME_INDEX$U" 
   (	"RID" ROWID, 
	 PRIMARY KEY ("RID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  TABLESPACE "TS_EXAMPLE" 
  MONITORING ;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007839" ON "MAIN_USER"."DR$AUTHOR_NAME_INDEX$U" ("RID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."DR$NOVEL_NAME_INDEX$I" 
   (	"TOKEN_TEXT" VARCHAR2(255) NOT NULL ENABLE, 
	"TOKEN_TYPE" NUMBER(10,0) NOT NULL ENABLE, 
	"TOKEN_FIRST" NUMBER(10,0) NOT NULL ENABLE, 
	"TOKEN_LAST" NUMBER(10,0) NOT NULL ENABLE, 
	"TOKEN_COUNT" NUMBER(10,0) NOT NULL ENABLE, 
	"TOKEN_INFO" BLOB
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
 LOB ("TOKEN_INFO") STORE AS SECUREFILE (
  TABLESPACE "TS_EXAMPLE" ENABLE STORAGE IN ROW CHUNK 8192
  NOCACHE LOGGING  NOCOMPRESS  KEEP_DUPLICATES 
  STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) 
  MONITORING ;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_IL0000075227C00006$$" ON "MAIN_USER"."DR$NOVEL_NAME_INDEX$I" (
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
  PARALLEL (DEGREE 0 INSTANCES 0) ;
  CREATE INDEX "MAIN_USER"."DR$NOVEL_NAME_INDEX$X" ON "MAIN_USER"."DR$NOVEL_NAME_INDEX$I" ("TOKEN_TEXT", "TOKEN_TYPE", "TOKEN_FIRST", "TOKEN_LAST", "TOKEN_COUNT") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS COMPRESS 2 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."DR$NOVEL_NAME_INDEX$K" 
   (	"DOCID" NUMBER, 
	"TEXTKEY" ROWID
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
  MONITORING ;

CREATE UNIQUE INDEX "MAIN_USER"."DR$NOVEL_NAME_INDEX$KD" ON "MAIN_USER"."DR$NOVEL_NAME_INDEX$K" ("DOCID", "TEXTKEY") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
  CREATE UNIQUE INDEX "MAIN_USER"."DR$NOVEL_NAME_INDEX$KR" ON "MAIN_USER"."DR$NOVEL_NAME_INDEX$K" ("TEXTKEY", "DOCID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."DR$NOVEL_NAME_INDEX$N" 
   (	"NLT_DOCID" NUMBER(38,0), 
	"NLT_MARK" CHAR(1) NOT NULL ENABLE, 
	 PRIMARY KEY ("NLT_DOCID") ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  ORGANIZATION INDEX NOCOMPRESS PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
 PCTTHRESHOLD 50
  MONITORING ;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_IOT_TOP_75231" ON "MAIN_USER"."DR$NOVEL_NAME_INDEX$N" ("NLT_DOCID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."DR$NOVEL_NAME_INDEX$U" 
   (	"RID" ROWID, 
	 PRIMARY KEY ("RID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  TABLESPACE "TS_EXAMPLE" 
  MONITORING ;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007819" ON "MAIN_USER"."DR$NOVEL_NAME_INDEX$U" ("RID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."DR$READER_NAME_INDEX$I" 
   (	"TOKEN_TEXT" VARCHAR2(255) NOT NULL ENABLE, 
	"TOKEN_TYPE" NUMBER(10,0) NOT NULL ENABLE, 
	"TOKEN_FIRST" NUMBER(10,0) NOT NULL ENABLE, 
	"TOKEN_LAST" NUMBER(10,0) NOT NULL ENABLE, 
	"TOKEN_COUNT" NUMBER(10,0) NOT NULL ENABLE, 
	"TOKEN_INFO" BLOB
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
 LOB ("TOKEN_INFO") STORE AS SECUREFILE (
  TABLESPACE "TS_EXAMPLE" ENABLE STORAGE IN ROW CHUNK 8192
  NOCACHE LOGGING  NOCOMPRESS  KEEP_DUPLICATES 
  STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)) 
  MONITORING ;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_IL0000075269C00006$$" ON "MAIN_USER"."DR$READER_NAME_INDEX$I" (
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
  PARALLEL (DEGREE 0 INSTANCES 0) ;
  CREATE INDEX "MAIN_USER"."DR$READER_NAME_INDEX$X" ON "MAIN_USER"."DR$READER_NAME_INDEX$I" ("TOKEN_TEXT", "TOKEN_TYPE", "TOKEN_FIRST", "TOKEN_LAST", "TOKEN_COUNT") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS COMPRESS 2 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."DR$READER_NAME_INDEX$K" 
   (	"DOCID" NUMBER, 
	"TEXTKEY" ROWID
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
  MONITORING ;

CREATE UNIQUE INDEX "MAIN_USER"."DR$READER_NAME_INDEX$KD" ON "MAIN_USER"."DR$READER_NAME_INDEX$K" ("DOCID", "TEXTKEY") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
  CREATE UNIQUE INDEX "MAIN_USER"."DR$READER_NAME_INDEX$KR" ON "MAIN_USER"."DR$READER_NAME_INDEX$K" ("TEXTKEY", "DOCID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."DR$READER_NAME_INDEX$N" 
   (	"NLT_DOCID" NUMBER(38,0), 
	"NLT_MARK" CHAR(1) NOT NULL ENABLE, 
	 PRIMARY KEY ("NLT_DOCID") ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  ORGANIZATION INDEX NOCOMPRESS PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" 
 PCTTHRESHOLD 50
  MONITORING ;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_IOT_TOP_75273" ON "MAIN_USER"."DR$READER_NAME_INDEX$N" ("NLT_DOCID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."DR$READER_NAME_INDEX$U" 
   (	"RID" ROWID, 
	 PRIMARY KEY ("RID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION DEFERRED 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  TABLESPACE "TS_EXAMPLE" 
  MONITORING ;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007847" ON "MAIN_USER"."DR$READER_NAME_INDEX$U" ("RID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."LIKES" 
   (	"COMMENT_ID" NUMBER, 
	"READER_ID" NUMBER, 
	 PRIMARY KEY ("COMMENT_ID", "READER_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."LIKES" ADD FOREIGN KEY ("COMMENT_ID")
	  REFERENCES "MAIN_USER"."COMMENTS" ("COMMENT_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."LIKES" ADD FOREIGN KEY ("READER_ID")
	  REFERENCES "MAIN_USER"."READER" ("READER_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007728" ON "MAIN_USER"."LIKES" ("COMMENT_ID", "READER_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."MANAGEMENT" 
   (	"MANAGEMENT_ID" NUMBER GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOKEEP  NOSCALE  NOT NULL ENABLE, 
	"MANAGER_ID" NUMBER NOT NULL ENABLE, 
	"RESULT" VARCHAR2(200), 
	"TIME" DATE DEFAULT SYSDATE, 
	 PRIMARY KEY ("MANAGEMENT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."MANAGEMENT" ADD CONSTRAINT "FK_MANAGEMENT_MANAGER" FOREIGN KEY ("MANAGER_ID")
	  REFERENCES "MAIN_USER"."MANAGER" ("MANAGER_ID") ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007660" ON "MAIN_USER"."MANAGEMENT" ("MANAGEMENT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."MANAGER" 
   (	"MANAGER_ID" NUMBER GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOKEEP  NOSCALE  NOT NULL ENABLE, 
	"MANAGER_NAME" VARCHAR2(20) NOT NULL ENABLE, 
	"PASSWORD" VARCHAR2(20) NOT NULL ENABLE, 
	 PRIMARY KEY ("MANAGER_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007743" ON "MAIN_USER"."MANAGER" ("MANAGER_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."NOVEL" 
   (	"NOVEL_ID" NUMBER GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOKEEP  NOSCALE  NOT NULL ENABLE, 
	"AUTHOR_ID" NUMBER, 
	"NOVEL_NAME" VARCHAR2(40), 
	"INTRODUCTION" VARCHAR2(1800), 
	"CREATE_TIME" DATE, 
	"COVER_URL" VARCHAR2(255), 
	"SCORE" NUMBER(3,1), 
	"TOTAL_WORD_COUNT" NUMBER(15,0), 
	"RECOMMEND_COUNT" NUMBER(6,0), 
	"COLLECTED_COUNT" NUMBER(6,0), 
	"STATUS" VARCHAR2(10) DEFAULT '待审核', 
	"ORIGINAL_NOVEL_ID" NUMBER DEFAULT -1 NOT NULL ENABLE, 
	"TOTAL_PRICE" NUMBER(10,2), 
	 PRIMARY KEY ("NOVEL_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE, 
	 CONSTRAINT "NOVEL_STATUS_CK" CHECK (status IN ('待审核', '连载', '完结', '封禁')) ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."NOVEL" ADD FOREIGN KEY ("AUTHOR_ID")
	  REFERENCES "MAIN_USER"."AUTHOR" ("AUTHOR_ID") ON DELETE CASCADE ENABLE;

CREATE INDEX "MAIN_USER"."NOVEL_NAME_INDEX" ON "MAIN_USER"."NOVEL" ("NOVEL_NAME") 
   INDEXTYPE IS "CTXSYS"."CONTEXT"  PARAMETERS ('LEXER my_lexer');
  CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007650" ON "MAIN_USER"."NOVEL" ("NOVEL_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."NOVEL_CATEGORY" 
   (	"NOVEL_ID" NUMBER, 
	"CATEGORY_NAME" VARCHAR2(20), 
	 PRIMARY KEY ("NOVEL_ID", "CATEGORY_NAME")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."NOVEL_CATEGORY" ADD FOREIGN KEY ("NOVEL_ID")
	  REFERENCES "MAIN_USER"."NOVEL" ("NOVEL_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."NOVEL_CATEGORY" ADD FOREIGN KEY ("CATEGORY_NAME")
	  REFERENCES "MAIN_USER"."CATEGORY" ("CATEGORY_NAME") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007674" ON "MAIN_USER"."NOVEL_CATEGORY" ("NOVEL_ID", "CATEGORY_NAME") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."NOVEL_MANAGEMENT" 
   (	"MANAGEMENT_ID" NUMBER, 
	"NOVEL_ID" NUMBER, 
	 PRIMARY KEY ("MANAGEMENT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."NOVEL_MANAGEMENT" ADD FOREIGN KEY ("MANAGEMENT_ID")
	  REFERENCES "MAIN_USER"."MANAGEMENT" ("MANAGEMENT_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."NOVEL_MANAGEMENT" ADD FOREIGN KEY ("NOVEL_ID")
	  REFERENCES "MAIN_USER"."NOVEL" ("NOVEL_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007677" ON "MAIN_USER"."NOVEL_MANAGEMENT" ("MANAGEMENT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."PURCHASE" 
   (	"TRANSACTION_ID" NUMBER, 
	"CHAPTER_ID" NUMBER, 
	"NOVEL_ID" NUMBER, 
	 PRIMARY KEY ("TRANSACTION_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."PURCHASE" ADD FOREIGN KEY ("TRANSACTION_ID")
	  REFERENCES "MAIN_USER"."TRANSACTION" ("TRANSACTION_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."PURCHASE" ADD FOREIGN KEY ("NOVEL_ID", "CHAPTER_ID")
	  REFERENCES "MAIN_USER"."CHAPTER" ("NOVEL_ID", "CHAPTER_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007683" ON "MAIN_USER"."PURCHASE" ("TRANSACTION_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."RATE" 
   (	"RATING_TIME" DATE, 
	"SCORE" NUMBER(*,0), 
	"NOVEL_ID" NUMBER, 
	"READER_ID" NUMBER, 
	 CHECK (score BETWEEN 0 AND 10) ENABLE, 
	 PRIMARY KEY ("NOVEL_ID", "READER_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."RATE" ADD FOREIGN KEY ("NOVEL_ID")
	  REFERENCES "MAIN_USER"."NOVEL" ("NOVEL_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."RATE" ADD FOREIGN KEY ("READER_ID")
	  REFERENCES "MAIN_USER"."READER" ("READER_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007696" ON "MAIN_USER"."RATE" ("NOVEL_ID", "READER_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."READER" 
   (	"READER_ID" NUMBER GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOKEEP  NOSCALE  NOT NULL ENABLE, 
	"READER_NAME" VARCHAR2(20) NOT NULL ENABLE, 
	"PASSWORD" VARCHAR2(20) NOT NULL ENABLE, 
	"PHONE" VARCHAR2(11), 
	"GENDER" CHAR(2), 
	"BALANCE" NUMBER(*,2) DEFAULT 0, 
	"AVATAR_URL" VARCHAR2(255), 
	"BACKGROUND_URL" VARCHAR2(255), 
	"IS_COLLECT_VISIBLE" VARCHAR2(2), 
	"IS_RECOMMEND_VISIBLE" VARCHAR2(2), 
	 CHECK (gender IN ('男', '女')) ENABLE, 
	 CHECK (is_collect_visible IN ('是', '否')) ENABLE, 
	 CHECK (is_recommend_visible IN ('是', '否')) ENABLE, 
	 PRIMARY KEY ("READER_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

CREATE INDEX "MAIN_USER"."READER_NAME_INDEX" ON "MAIN_USER"."READER" ("READER_NAME") 
   INDEXTYPE IS "CTXSYS"."CONTEXT" ;
  CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007667" ON "MAIN_USER"."READER" ("READER_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."RECENT_READINGS" 
   (	"READER_ID" NUMBER NOT NULL ENABLE, 
	"NOVEL_ID" NUMBER NOT NULL ENABLE, 
	"RECENT_READING_TIME" TIMESTAMP (6) NOT NULL ENABLE, 
	"CHAPTER_ID" NUMBER, 
	 CONSTRAINT "UQ_READER_NOVEL" UNIQUE ("READER_ID", "NOVEL_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."RECENT_READINGS" ADD CONSTRAINT "FK_RECENT_CHAPTER" FOREIGN KEY ("NOVEL_ID", "CHAPTER_ID")
	  REFERENCES "MAIN_USER"."CHAPTER" ("NOVEL_ID", "CHAPTER_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."UQ_READER_NOVEL" ON "MAIN_USER"."RECENT_READINGS" ("READER_ID", "NOVEL_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
  CREATE INDEX "MAIN_USER"."IDX_READER_TIME" ON "MAIN_USER"."RECENT_READINGS" ("READER_ID", "RECENT_READING_TIME" DESC) 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."RECOMMEND" 
   (	"NOVEL_ID" NUMBER, 
	"READER_ID" NUMBER, 
	"REASON" VARCHAR2(200), 
	 PRIMARY KEY ("NOVEL_ID", "READER_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."RECOMMEND" ADD FOREIGN KEY ("NOVEL_ID")
	  REFERENCES "MAIN_USER"."NOVEL" ("NOVEL_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."RECOMMEND" ADD FOREIGN KEY ("READER_ID")
	  REFERENCES "MAIN_USER"."READER" ("READER_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007689" ON "MAIN_USER"."RECOMMEND" ("NOVEL_ID", "READER_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."REPORT" 
   (	"REPORT_ID" NUMBER GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOKEEP  NOSCALE  NOT NULL ENABLE, 
	"REASON" VARCHAR2(200), 
	"REPORT_TIME" DATE, 
	"PROGRESS" VARCHAR2(10) DEFAULT '未处理', 
	"COMMENT_ID" NUMBER, 
	"READER_ID" NUMBER, 
	 CHECK (progress IN ('成功', '失败', '未处理')) ENABLE, 
	 PRIMARY KEY ("REPORT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."REPORT" ADD FOREIGN KEY ("COMMENT_ID")
	  REFERENCES "MAIN_USER"."COMMENTS" ("COMMENT_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."REPORT" ADD FOREIGN KEY ("READER_ID")
	  REFERENCES "MAIN_USER"."READER" ("READER_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007718" ON "MAIN_USER"."REPORT" ("REPORT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."REPORT_MANAGEMENT" 
   (	"MANAGEMENT_ID" NUMBER, 
	"REPORT_ID" NUMBER, 
	 PRIMARY KEY ("MANAGEMENT_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."REPORT_MANAGEMENT" ADD FOREIGN KEY ("MANAGEMENT_ID")
	  REFERENCES "MAIN_USER"."MANAGEMENT" ("MANAGEMENT_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."REPORT_MANAGEMENT" ADD FOREIGN KEY ("REPORT_ID")
	  REFERENCES "MAIN_USER"."REPORT" ("REPORT_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007721" ON "MAIN_USER"."REPORT_MANAGEMENT" ("MANAGEMENT_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."REWARD" 
   (	"TRANSACTION_ID" NUMBER, 
	"NOVEL_ID" NUMBER, 
	 PRIMARY KEY ("TRANSACTION_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."REWARD" ADD FOREIGN KEY ("TRANSACTION_ID")
	  REFERENCES "MAIN_USER"."TRANSACTION" ("TRANSACTION_ID") ON DELETE CASCADE ENABLE;
  ALTER TABLE "MAIN_USER"."REWARD" ADD FOREIGN KEY ("NOVEL_ID")
	  REFERENCES "MAIN_USER"."NOVEL" ("NOVEL_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007692" ON "MAIN_USER"."REWARD" ("TRANSACTION_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE TABLE "MAIN_USER"."TRANSACTION" 
   (	"READER_ID" NUMBER NOT NULL ENABLE, 
	"TRANSACTION_ID" NUMBER GENERATED ALWAYS AS IDENTITY MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE  NOKEEP  NOSCALE  NOT NULL ENABLE, 
	"TRANS_TYPE" VARCHAR2(10), 
	"AMOUNT" NUMBER(*,0) NOT NULL ENABLE, 
	"TIME" DATE, 
	 CHECK (trans_type IN ('打赏', '充值', '解锁章节')) ENABLE, 
	 PRIMARY KEY ("TRANSACTION_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."TRANSACTION" ADD FOREIGN KEY ("READER_ID")
	  REFERENCES "MAIN_USER"."READER" ("READER_ID") ON DELETE CASCADE ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007672" ON "MAIN_USER"."TRANSACTION" ("TRANSACTION_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
  CREATE INDEX "MAIN_USER"."IDX_TRANSACTION_READER_TYPE_TIME" ON "MAIN_USER"."TRANSACTION" ("READER_ID", "TRANS_TYPE", "TIME") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE OR REPLACE FORCE EDITIONABLE VIEW "MAIN_USER"."V_READER_RECHARGE_RECORD" ("READER_ID", "RECHARGE_AMOUNT", "VIRTUAL_COIN", "RECHARGE_TIME") AS 
  SELECT 
    t.READER_ID,
    (t.AMOUNT / 100) AS RECHARGE_AMOUNT,  -- 充值金额=虚拟币/100
    t.AMOUNT AS VIRTUAL_COIN,             -- 虚拟币直接取AMOUNT值
    t.TIME AS RECHARGE_TIME
FROM 
    MAIN_USER."TRANSACTION" t
WHERE 
    t.TRANS_TYPE = '充值';
;

CREATE OR REPLACE FORCE EDITIONABLE VIEW "MAIN_USER"."V_READER_REWARD_RECORD" ("READER_ID", "TRANSACTION_ID", "AMOUNT", "REWARD_TIME", "NOVEL_ID", "NOVEL_TITLE", "AUTHOR_ID", "AUTHOR_NAME") AS 
  SELECT
    t.READER_ID,
    t.TRANSACTION_ID,
    t.AMOUNT,
    t.TIME AS REWARD_TIME,
    r.NOVEL_ID,
    n."NOVEL_NAME" AS NOVEL_TITLE,  
    a.AUTHOR_ID,
    a.AUTHOR_NAME
FROM
    TRANSACTION t
JOIN
    REWARD r ON t.TRANSACTION_ID = r.TRANSACTION_ID
JOIN
    NOVEL n ON r.NOVEL_ID = n.NOVEL_ID
JOIN
    AUTHOR a ON n.AUTHOR_ID = a.AUTHOR_ID
WHERE
    t.TRANS_TYPE = '打赏';
;

CREATE OR REPLACE FORCE EDITIONABLE VIEW "MAIN_USER"."V_READER_SUBSCRIPTION_RECORD" ("READER_ID", "CHAPTER_ID", "CHAPTER_TITLE", "NOVEL_ID", "NOVEL_TITLE", "CONSUME_AMOUNT", "CONSUME_TIME") AS 
  SELECT 
    tr.READER_ID,
    c.CHAPTER_ID,
    c.TITLE AS CHAPTER_TITLE,
    n.NOVEL_ID,
    n.NOVEL_NAME AS NOVEL_TITLE,
    tr.AMOUNT AS CONSUME_AMOUNT,
    tr.TIME AS CONSUME_TIME
FROM MAIN_USER."TRANSACTION" tr
JOIN MAIN_USER."PURCHASE" p 
    ON tr.TRANSACTION_ID = p.TRANSACTION_ID
JOIN MAIN_USER."CHAPTER" c 
    ON p.NOVEL_ID = c.NOVEL_ID 
    AND p.CHAPTER_ID = c.CHAPTER_ID
JOIN MAIN_USER."NOVEL" n 
    ON c.NOVEL_ID = n.NOVEL_ID
WHERE tr.TRANS_TYPE = '解锁章节';
;

CREATE TABLE "MAIN_USER"."WHOLEPURCHASE" 
   (	"READER_ID" NUMBER NOT NULL ENABLE, 
	"NOVEL_ID" NUMBER NOT NULL ENABLE, 
	"IS_BOUGHT" VARCHAR2(2) DEFAULT '否', 
	 CHECK (IS_BOUGHT IN ('是', '否')) ENABLE, 
	 PRIMARY KEY ("READER_ID", "NOVEL_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE"  ENABLE
   ) SEGMENT CREATION IMMEDIATE 
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 
 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;

ALTER TABLE "MAIN_USER"."WHOLEPURCHASE" ADD FOREIGN KEY ("READER_ID")
	  REFERENCES "MAIN_USER"."READER" ("READER_ID") ENABLE;
  ALTER TABLE "MAIN_USER"."WHOLEPURCHASE" ADD FOREIGN KEY ("NOVEL_ID")
	  REFERENCES "MAIN_USER"."NOVEL" ("NOVEL_ID") ENABLE;

CREATE UNIQUE INDEX "MAIN_USER"."SYS_C007859" ON "MAIN_USER"."WHOLEPURCHASE" ("READER_ID", "NOVEL_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_EXAMPLE" ;
;

CREATE OR REPLACE PROCEDURE MAIN_USER.update_daily_novel_scores AS
BEGIN
    DBMS_OUTPUT.PUT_LINE('[' || TO_CHAR(SYSTIMESTAMP, 'YYYY-MM-DD HH24:MI:SS.FF') || '] 开始更新小说评分');

    MERGE INTO main_user.novel n
    USING (
        SELECT 
            novel_id,
            ROUND(AVG(score), 1) AS avg_score
        FROM main_user.rate
        GROUP BY novel_id
    ) r
    ON (n.novel_id = r.novel_id)
    WHEN MATCHED THEN
        UPDATE SET n.score = r.avg_score;

    DBMS_OUTPUT.PUT_LINE('[' || TO_CHAR(SYSTIMESTAMP, 'YYYY-MM-DD HH24:MI:SS.FF') || '] 小说评分更新完成');

    COMMIT;
EXCEPTION
    WHEN OTHERS THEN
        ROLLBACK;
        DBMS_OUTPUT.PUT_LINE('错误：' || SQLERRM);
        RAISE;
END;

CREATE SEQUENCE MAIN_USER."ISEQ$$_74148" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9999999999999999999999999999 NOCYCLE CACHE 20 NOORDER ;

CREATE SEQUENCE MAIN_USER."ISEQ$$_74153" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9999999999999999999999999999 NOCYCLE CACHE 20 NOORDER ;

CREATE SEQUENCE MAIN_USER."ISEQ$$_74160" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9999999999999999999999999999 NOCYCLE CACHE 20 NOORDER ;

CREATE SEQUENCE MAIN_USER."ISEQ$$_74165" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9999999999999999999999999999 NOCYCLE CACHE 20 NOORDER ;

CREATE SEQUENCE MAIN_USER."ISEQ$$_74168" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9999999999999999999999999999 NOCYCLE CACHE 20 NOORDER ;

CREATE SEQUENCE MAIN_USER."ISEQ$$_74194" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9999999999999999999999999999 NOCYCLE CACHE 20 NOORDER ;

CREATE SEQUENCE MAIN_USER."ISEQ$$_74201" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9999999999999999999999999999 NOCYCLE CACHE 20 NOORDER ;

CREATE SEQUENCE MAIN_USER."ISEQ$$_74394" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9999999999999999999999999999 NOCYCLE CACHE 20 NOORDER ;

CREATE SEQUENCE MAIN_USER."ISEQ$$_74397" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9999999999999999999999999999 NOCYCLE CACHE 20 NOORDER ;

CREATE SEQUENCE MAIN_USER.MANAGER_SEQ INCREMENT BY 1 MINVALUE 1 MAXVALUE 9999999999999999999999999999 NOCYCLE CACHE 20 NOORDER ;

CREATE SEQUENCE MAIN_USER.READER_SEQ INCREMENT BY 1 MINVALUE 1 MAXVALUE 9999999999999999999999999999 NOCYCLE NOCACHE NOORDER ;